package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.dto.MallOrderRefundDTO;
import com.sc.nft.entity.MallOrderRefund;
import com.sc.nft.entity.dto.AdminPageRefundOrderDTO;
import com.sc.nft.entity.dto.RefundOrderLogDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商城订单售后(sc_mall_order_refund)数据Mapper
 *
 * @author liGen
 * @version 1.0
 * @date 2023/11/15 1:35 下午
 */
@Mapper
public interface MallOrderRefundMapper extends BaseMapper<MallOrderRefund> {

    /**
     * 获取订单下的所有售后订单
     *
     * @param orderId
     * @return
     */
    List<MallOrderRefundDTO> getRefundListByOrderId(@Param("orderId") Long orderId);

    /**
     * 获取用户下的所有售后订单
     *
     * @param userId
     * @return
     */
    Page<MallOrderRefundDTO> getRefundListByUserId(Page page, @Param("userId") Long userId);


    /**
     * 获取售后详情
     *
     * @param id
     * @return
     */
    MallOrderRefundDTO getDetailsById(Long id);

    /**
     * 管理后台售后列表
     *
     * @param page
     * @param orderNo
     * @param refundNo
     * @param refundStatus
     * @param refundType
     * @param userTel
     * @return
     */
    Page<AdminPageRefundOrderDTO> getAdminPageRefundOrderDTO(Page page, @Param("orderNo") String orderNo, @Param("refundNo") String refundNo,
                                                             @Param("refundStatus") Integer refundStatus, @Param("refundType") Integer refundType, @Param("userTel") String userTel);

    /**
     * 售后详情
     *
     * @param id
     * @return
     */
    AdminPageRefundOrderDTO getAdminRefundOrderDTO(@Param("id") Long id);

    /**
     * 获取售后单的状态操作时间
     *
     * @param refundStatus 售后单状态
     * @param changeType   操作类型
     * @return
     */
    List<RefundOrderLogDTO> getRefundOrderLogDTOList(@Param("refundStatus") Integer refundStatus, @Param("changeType") String changeType);

    /**
     * 获取分享团的售后单
     *
     * @param teamId
     * @return
     */
    List<MallOrderRefund> getListByTeamOrder(@Param("teamId") Long teamId);

}
